package org.qf.test;

import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
import org.junit.Test;
import org.qf.dao.impl.SmbmsGoodsDaoimpl;
import org.qf.dao.impl.SmbmsOrderImpl;
import org.qf.pojo.Goods;
import org.qf.pojo.SmbmsBill;
import org.qf.service.impl.SmbmsGoodsServiceImpl;
import org.qf.service.impl.SmbmsOrderServiceImpl;
import org.qf.utils.BaseDao;
import org.qf.web.SmbmsUpdateGoodsServlet;

import java.math.BigDecimal;
import java.sql.Connection;
import java.util.List;

/**
 * @author zzzyyystart
 * @create 2022-04-17-16:43
 */
public class test2 {
    @Test
    public void test1() {
        BaseDao dao = new BaseDao();
        Connection conn = BaseDao.getConnection1();
        String sql = "update smbms_user set userPassword=? where userPassword=? ";
        int admin = dao.update(conn, sql, "admin", "11111");
        System.out.println(admin);


    }

    @Test
    public void test2() {
        BaseDao dao = new BaseDao();
        System.out.println(dao.getConnection());

    }

    @Test
    public void test3() {
        SmbmsOrderImpl order = new SmbmsOrderImpl();
        System.out.println(order.showBillList());
    }

    @Test
    public void test4() {
        SmbmsOrderServiceImpl orderService = new SmbmsOrderServiceImpl();
        List<SmbmsBill> smbmsBills = orderService.showBillList();
        System.out.println(smbmsBills);
    }

    @Test
    public void test5() {
        SmbmsOrderImpl orderDao = new SmbmsOrderImpl();
        System.out.println(orderDao.showBillDetail("1652258112833539"));
    }

    @Test
    public void test6() {
        SmbmsGoodsDaoimpl smbmsGoodsDaoimpl = new SmbmsGoodsDaoimpl();
        System.out.println(smbmsGoodsDaoimpl.showGoods("t_fruit"));

    }

    @Test
    public void test7() {
        SmbmsGoodsDaoimpl goodsDao = new SmbmsGoodsDaoimpl();
        Goods t_fruit = goodsDao.showGoodForOne("t_fruit", "1");
        System.out.println(t_fruit);
    }

    @Test
    public void test8() {
        SmbmsGoodsServiceImpl goodsService = new SmbmsGoodsServiceImpl();
//        SmbmsGoodsDaoimpl goodsDao = new SmbmsGoodsDaoimpl();
        Goods goods =
                new Goods(null, "油麦菜", new BigDecimal("7"), Integer.parseInt("0"), Integer.parseInt("2"), "123444");
        int t_frult = goodsService.addGoods("t_fruit", goods);
        System.out.println(t_frult);
    }
    @Test
    public void test9() {
        SmbmsGoodsServiceImpl goodsService = new SmbmsGoodsServiceImpl();
        System.out.println(goodsService.deleteGoods("7", "t_fruit"));

    }
    @Test
    public void test10() {
        SmbmsOrderServiceImpl orderService = new SmbmsOrderServiceImpl();
        List<SmbmsBill> shipped = orderService.billStatusClassify("NOT_SHIPPED");
        System.out.println(shipped);
    }
}
